package cn.edu.scau.cmi.linyuetao.hibernate;

import javafx.beans.property.LongProperty;
import javafx.beans.property.SimpleLongProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;

/**
 * Student entity. @author MyEclipse Persistence Tools
 */

public class Student implements java.io.Serializable {

	// Fields

	private Long id;
	private Teacher teacher;
	private String name;
	private Long tid;
	private String tname;
	// Constructors

	/** default constructor */
	public Student() {
	}

	/** minimal constructor */
	public Student(String name) {
		this.name = name;
	}

	/** full constructor */
	public Student(Teacher teacher, String name) {
		this.teacher = teacher;
		this.name = name;
		this.tid = teacher.getId();
		this.tname = teacher.getName();
	}
	

	// Property accessors

	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Teacher getTeacher() {
		if(teacher!=null){
			this.tid = teacher.getId();
			this.tname = teacher.getName();
		}
		return this.teacher;
	}

	public void setTeacher(Teacher teacher) {
		this.teacher = teacher;
		if(teacher!=null){
			this.tid = teacher.getId();
			this.tname = teacher.getName();
		}
		
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Long getTid() {
		return tid;
	}

	public void setTid(Long tid) {
		this.tid = tid;
	}

	public String getTname() {
		return tname;
	}

	public void setTname(String tname) {
		this.tname = tname;
	}

}